home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / What's New? / Technical Documentaion / Macintosh Technotes and Q&As / technotes / tn / 1076_MsgTest.hqx / MsgTest / PCMsgTst / PCMSGTST.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-27  |  2.4 KB  |  71 lines

  1. // --------------------------------------------------------------------------------------
  2. //
  3. // Test.
  4. // By Ben Manuto
  5. //
  6. // A Simple application to receive and send a short message via the Message system API.
  7. //
  8. // c.1996, by Apple Computer, Inc. All rights reserved.
  9. //
  10. // --------------------------------------------------------------------------------------
  11.  
  12.  
  13. typedef char    SInt8;
  14. typedef short    SInt16;
  15. typedef long    SInt32;
  16. typedef unsigned char  UInt8;
  17. typedef unsigned short UInt16;
  18. typedef unsigned long  UInt32;
  19. typedef char __far* Ptr32;
  20.  
  21.  
  22. #define true    1
  23. #define false    0
  24.  
  25. // ----------------------------------------------
  26.  
  27. typedef struct MsgPBlk {                                                                        
  28.    struct MsgPBlk*     link;            // Link to next Queue element
  29.    SInt16             msgCmd;          // The message command or type
  30.    SInt32             msgParam1;       // Param 1
  31.    SInt32             msgParam2;       // Param 2
  32.    UInt32             msgCompletion;   // Ptr to the completion routine
  33.    Ptr32             msgBuffer;       // Ptr to the data buffer
  34.    SInt32             msgReqCount;     // Length of the data
  35.    SInt32             msgActCount;     // # of bytes actually transfered
  36.    SInt8              msgResult;       // The error code after complete or 1
  37.    UInt8              msgFlags;        
  38.    UInt32             msgUserData;     // for caller's use
  39.    SInt32             msgVXD;          // Used by VxD
  40. } MsgPBlk, *MsgPBlkPtr;
  41.  
  42.  
  43. typedef struct MsgRecElem {
  44.    struct MsgRecElem*    Link;               // Ptr to next link
  45.    SInt32                 Code;               // Ptr to the Code for this link
  46.    SInt16                 cmdBase;            // the base message number for this proc
  47.    SInt16                 cmdCount;           // the # of message numbers for this proc
  48.    UInt32                 userData;           // for caller's use
  49.    UInt32                 recVXD;             // Used by VxD
  50. } MsgRecElem, *MsgRecElemPtr;
  51.  
  52.  
  53. typedef struct AckInfo {
  54.     SInt32    bytesReceived;        // Number of bytes received by the Mac.
  55.     UInt8    ackReceived;        // Was the ack received from the Mac.
  56. } AckInfo;
  57.  
  58.  
  59. // externs
  60.  
  61. extern UInt16 MsgAvailable();
  62. extern UInt16 MsgRegister(SInt32 msgSel, SInt16 msgCount, SInt16 *msgCmmd);
  63. extern UInt16 MsgInstHandler(MsgRecElemPtr msgRecElem);
  64. extern UInt16 MsgRmvHandler(MsgRecElemPtr msgRecElem);
  65. extern UInt16 MsgSend(MsgPBlkPtr msgPBlk);
  66. extern UInt16 MsgReceive(MsgPBlkPtr msgPBlk);
  67. extern void MsgHandler();
  68.  
  69.  
  70.  
  71.